/**
 * Copyright (C) 2018-2020
 * All rights reserved, Designed By www.qingtingshuzi.com
 * 注意：
 * 本软件为www.qingtingshuzi.com开发研制，未经购买不得使用
 * 购买后可获得全部源代码（禁止转卖、分享、上传到码云、github等开源平台）
 * 一经发现盗用、分享等行为，将追究法律责任，后果自负
 */
package co.qingting.modules.product.service.mapper;


import co.qingting.modules.product.domain.YxStoreProductRelation;
import co.qingting.modules.product.vo.YxStoreProductRelationQueryVo;
import co.qingting.common.mapper.CoreMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 商品点赞和收藏表 Mapper 接口
 * </p>
 *
 * @author qingting
 * @since 2019-10-23
 */
@Repository
public interface YxStoreProductRelationMapper extends CoreMapper<YxStoreProductRelation> {

    @Select("SELECT " +
            "  B.id pid, " +
            "  A.type AS type, " +
            "  A.category AS category, " +
            "  B.store_name AS storeName, " +
            "  B.price, " +
            "  B.ot_price AS otPrice, " +
            "  B.sales, " +
            "  B.image, " +
            "  B.is_show AS isShow  " +
            "FROM " +
            "  yx_store_product_relation A " +
            "  LEFT JOIN yx_store_product B ON A.product_id = B.id " +
            "where A.type=#{type} and A.uid=#{uid} and A.is_del = 0 and B.is_del = 0 order by A.create_time desc")
    List<YxStoreProductRelationQueryVo> selectRelationList(Page page, @Param("uid") Long uid, @Param("type") String type);


}
